#   E1_CS       PD3     DRIVE7
#   E1_DIR      PA14    DRIVE7
#   E1_STEP     PE6     DRIVE7
#   E1_ENABLE   PE0     DRIVE7
#   E1_DIAG7    PG15

[extruder1]                                 # Extruder 1
step_pin:                       PE6         #
dir_pin:                        !PA14       #
enable_pin:                     !PE0        #
microsteps:                     256
rotation_distance:              7.8         # 7.41 * Pi * 17 / 50 = 7,9149285314541250849827837398344  (5,5 ÷ 0,7 = 7,8571428571428571428571428571429)
#full_steps_per_rotation:
#gear_ratio:
#   The gear ratio if the stepper motor is connected to the axis via a
#   gearbox. For example, one may specify "5:1" if a 5 to 1 gearbox is
#   in use. If the axis has multiple gearboxes one may specify a comma
#   separated list of gear ratios (for example, "57:11, 2:1"). If a
#   gear_ratio is specified then rotation_distance specifies the
#   distance the axis travels for one full rotation of the final gear.
#   The default is to not use a gear ratio.
nozzle_diameter:                0.400
filament_diameter:              1.750
#max_extrude_cross_section:
#   Maximum area (in mm^2) of an extrusion cross section (eg,
#   extrusion width multiplied by layer height). This setting prevents
#   excessive amounts of extrusion during relatively small XY moves.
#   If a move requests an extrusion rate that would exceed this value
#   it will cause an error to be returned. The default is: 4.0 *
#   nozzle_diameter^2
instantaneous_corner_velocity:  1.000
max_extrude_only_distance:      50.0
max_extrude_only_velocity:      50
max_extrude_only_accel:         3000
pressure_advance:               0.09
#pressure_advance_smooth_time:   0.04
heater_pin:                     PA3         # HE1
#max_power:                      1.0
sensor_type:                    NTC 100K MGB18-104F39050L32
sensor_pin:                     PF5         # T1
pullup_resistor:                4700
smooth_time:                    1.0         # сглаживание температуры
control:                        pid
pid_kp:                         15.572      # ?
pid_ki:                         0.446       # ?
pid_kd:                         136.064     # ?
#max_delta: 2.0#   On 'watermark' controlled heaters this is the number of degrees in
#   Celsius above the target temperature before disabling the heater
#   as well as the number of degrees below the target before
#   re-enabling the heater. The default is 2 degrees Celsius.
#pwm_cycle_time: 0.100
#   Time in seconds for each software PWM cycle of the heater. It is
#   not recommended to set this unless there is an electrical
#   requirement to switch the heater faster than 10 times a second.
#   The default is 0.100 seconds.
min_extrude_temp:               170
min_temp:                       -100
max_temp:                       280        # ?

[tmc2130 extruder1]
cs_pin:                         PD3
#spi_speed:                      100000
spi_bus:                        spi1
#spi_software_sclk_pin:          PA5
#spi_software_mosi_pin:          PA7
#spi_software_miso_pin:          PA6
#   See the "common SPI settings" section for a description of the
#   above parameters.
#chain_position:
#chain_length:
#   These parameters configure an SPI daisy chain. The two parameters
#   define the stepper position in the chain and the total chain length.
#   Position 1 corresponds to the stepper that connects to the MOSI signal.
#   The default is to not use an SPI daisy chain.
interpolate:                    False
#   If true, enable step interpolation (the driver will internally
#   step at a rate of 256 micro-steps). This interpolation does
#   introduce a small systemic positional deviation - see
#   TMC_Drivers.md for details. The default is True.
run_current:                    0.75         # 0.8         # Imax / squart(2) * 80%; Imax = Irms / squart(2)
#   The amount of current (in amps RMS) to configure the driver to use
#   during stepper movement. This parameter must be provided.
#hold_current:                   0.4         # ~~ run_current/2
#   The amount of current (in amps RMS) to configure the driver to use
#   when the stepper is not moving. Setting a hold_current is not
#   recommended (see TMC_Drivers.md for details). The default is to
#   not reduce the current.
sense_resistor:                 0.110
#   The resistance (in ohms) of the motor sense resistor. The default
#   is 0.110 ohms.
stealthchop_threshold:          999999
#   The velocity (in mm/s) to set the "stealthChop" threshold to. When
#   set, "stealthChop" mode will be enabled if the stepper motor
#   velocity is below this value. The default is 0, which disables
#   "stealthChop" mode.
#driver_MSLUT0: 2863314260
#driver_MSLUT1: 1251300522
#driver_MSLUT2: 608774441
#driver_MSLUT3: 269500962
#driver_MSLUT4: 4227858431
#driver_MSLUT5: 3048961917
#driver_MSLUT6: 1227445590
#driver_MSLUT7: 4211234
#driver_W0: 2
#driver_W1: 1
#driver_W2: 1
#driver_W3: 1
#driver_X1: 128
#driver_X2: 255
#driver_X3: 255
#driver_START_SIN: 0
#driver_START_SIN90: 247
#   These fields control the Microstep Table registers directly. The optimal
#   wave table is specific to each motor and might vary with current. An
#   optimal configuration will have minimal print artifacts caused by
#   non-linear stepper movement. The values specified above are the default
#   values used by the driver. The value must be specified as a decimal integer
#   (hex form is not supported). In order to compute the wave table fields,
#   see the tmc2130 "Calculation Sheet" from the Trinamic website.
#driver_IHOLDDELAY:              8
#driver_TPOWERDOWN:              0
#driver_TBL:                     1
#driver_TOFF:                    4
#driver_HEND:                    7
#driver_HSTRT:                   0
driver_PWM_AUTOSCALE:           True
#driver_PWM_FREQ:                1
#driver_PWM_GRAD:                4
#driver_PWM_AMPL:                128
#driver_SGT:                     0
#   Set the given register during the configuration of the TMC2130
#   chip. This may be used to set custom motor parameters. The
#   defaults for each parameter are next to the parameter name in the
#   above list.
#diag0_pin:
#diag1_pin:                      PG15
#   The micro-controller pin attached to one of the DIAG lines of the
#   TMC2130 chip. Only a single diag pin should be specified. The pin
#   is "active low" and is thus normally prefaced with "^!". Setting
#   this creates a "tmc2130_stepper_x:virtual_endstop" virtual pin
#   which may be used as the stepper's endstop_pin. Doing this enables
#   "sensorless homing". (Be sure to also set driver_SGT to an
#   appropriate sensitivity value.) The default is to not enable
#   sensorless homing.

[verify_heater extruder1]
#max_error: 120
#   The maximum "cumulative temperature error" before raising an
#   error. Smaller values result in stricter checking and larger
#   values allow for more time before an error is reported.
#   Specifically, the temperature is inspected once a second and if it
#   is close to the target temperature then an internal "error
#   counter" is reset; otherwise, if the temperature is below the
#   target range then the counter is increased by the amount the
#   reported temperature differs from that range. Should the counter
#   exceed this "max_error" then an error is raised. The default is
#   120.
#check_gain_time:
#   This controls heater verification during initial heating. Smaller
#   values result in stricter checking and larger values allow for
#   more time before an error is reported. Specifically, during
#   initial heating, as long as the heater increases in temperature
#   within this time frame (specified in seconds) then the internal
#   "error counter" is reset. The default is 20 seconds for extruders
#   and 60 seconds for heater_bed.
#hysteresis: 5
#   The maximum temperature difference (in Celsius) to a target
#   temperature that is considered in range of the target. This
#   controls the max_error range check. It is rare to customize this
#   value. The default is 5.
#heating_gain: 2
#   The minimum temperature (in Celsius) that the heater must increase
#   by during the check_gain_time check. It is rare to customize this
#   value. The default is 2.
